﻿using System.Windows;
using System.Windows.Input;
using StudentInfoSystem.UI.ViewModels.Windows;

namespace StudentInfoSystem.UI.Views.Windows
{
    public partial class StudentEditDialog : Window
    {
        public StudentEditDialog()
        {
            InitializeComponent();
            DataContext = new StudentEditViewModel();
        }

        public StudentEditDialog(StudentInfoSystem.Core.Models.Student student)
        {
            InitializeComponent();
            DataContext = new StudentEditViewModel(student);
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }

        private void MinimizeButton_Click(object sender, RoutedEventArgs e)
        {
            this.WindowState = WindowState.Minimized;
        }

        private void MaximizeButton_Click(object sender, RoutedEventArgs e)
        {
            this.WindowState = this.WindowState == WindowState.Maximized
                ? WindowState.Normal
                : WindowState.Maximized;
        }
        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
                this.DragMove();
        }
        private void CloseButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }
    }
}